package com.financing.platform.dao.impl;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.financing.platform.dao.IProductNoticeDao;
import com.financing.platform.dto.ProductNoticeDTO;
import com.financing.platform.util.SqlName;

@Repository("productNoticeDaoImpl")
public class ProductNoticeDaoImpl extends BaseDaoImpl implements IProductNoticeDao {

	@Override
	public int insertProdcutNotice(Map<String, String> productNotice) throws SQLException {
		 sqlMapClient.insert(SqlName.insertproductnotice, productNotice);
		 return 0;
	}

	@Override
	public int queryProdcutNotice(String detailUrl) throws SQLException {
		return (Integer) sqlMapClient.queryForObject(SqlName.queryproductnoticeUrl, detailUrl);
	}

	@Override
	public List<String> queryProdcutNoticeUrlList(Integer id) throws SQLException {
		return sqlMapClient.queryForList(SqlName.queryproductnoticeUrlList,id);
	}

	@Override
	public List<ProductNoticeDTO> queryProdcutNoticeList(ProductNoticeDTO pndto)
			throws SQLException {
		return sqlMapClient.queryForList(SqlName.queryproductnotice,pndto);
	}

	@Override
	public ProductNoticeDTO queryProdcutNoticeDetail(ProductNoticeDTO pndto)
			throws SQLException {
		return (ProductNoticeDTO) sqlMapClient.queryForObject(SqlName.queryproductnoticeDetail,pndto);
	}

	@Override
	public int updateProdcutNotice(ProductNoticeDTO pndto)
			throws SQLException {
		return sqlMapClient.update(SqlName.updateproductnotice,pndto);
	}

	@Override
	public int countProdcutNoticeList(ProductNoticeDTO pndto)
			throws SQLException {
		return (Integer) sqlMapClient.queryForObject(SqlName.countproductnotice,pndto);
	}

}
